import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path' // ✅ 新增此行导入

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
   resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src') // 精确指向 src 目录
    }
  },
  server: {
    // 代理配置
     proxy: {
      '/api': {
        target: 'http://localhost:9999', // ✅ 确认后端地址正确
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '') ,// 按需调整
        secure: false  // 若后端为HTTP协议需开启
    }
  }
  }
})


